﻿using UnityEngine;
using System.Collections;

public class ButtonUI : MonoBehaviour {



	public GameObject[] buttonsToShow;
	public GameObject[] buttonsToHide;
	private float x;
	private float y;
	public bool onlyOnce;
	Animator anim;
	Huge_UI kill;
    move_camera CamMoove;
	
	void Awake()
	{
		kill = GameObject.Find ("Huge_collider").GetComponent<Huge_UI> ();
		x = gameObject.transform.localScale.x;
		y = gameObject.transform.localScale.y;
		anim = gameObject.GetComponent<Animator> ();
        CamMoove = gameObject.GetComponent<move_camera>();
	}
	

	void OnMouseDown(){

		anim.SetBool ("click", true);
		if (onlyOnce) 
		{
			foreach(GameObject but in buttonsToShow)
			{
				but.SetActive(false);
			}
			gameObject.SetActive(false);
		}



	}

	void OnMouseUp()
	{
		kill.killThemAll ();
		anim.SetBool ("click", false);

		foreach (GameObject button in buttonsToShow) 
		{
			button.gameObject.GetComponent<Animator>().SetBool("intro", true);
		}

        if(CamMoove != null)
        {
            CamMoove.start = true;
        }
		/*foreach (GameObject button in buttonsToHide) 
		{
			button.gameObject.GetComponent<Animator>().SetBool("intro", false);
		}
		anim.SetBool("intro", false);*/

	}

}
